import React from 'react'
import { Pagination } from 'antd';
import type { PaginationProps } from 'antd';
type TypeProps = {
    total: number,
    page: number,
    pagesize: number,
    onpage:Function,
    onsize:Function
}
const Paginations: React.FC<TypeProps> = ({ total, page, pagesize,onpage,onsize}) => {

    const onShowSizeChange: PaginationProps['onShowSizeChange'] = (current, pageSize) => {
        onsize(1,pageSize)
    };
    const handelchange = (page:number,pagesize:number)=>{
        onpage(page,pagesize)
    }   
    return (
        <div style={{ width: "100%", display: "flex", justifyContent: "end" }}>
            <Pagination
                showSizeChanger
                onShowSizeChange={onShowSizeChange}
                //   defaultCurrent={3}
                current={page}
                pageSize={pagesize}
                total={total}
                onChange={handelchange}
            />
        </div>
    )
}

export default Paginations